/**
 * 文件名：EvidenceState.java
 *
 * 创建人：Elvin Zhao - 279152260@qq.com
 *
 * 创建时间：2019年1月2日 下午5:23:25
 *
 * 版权所有：FNII
 */
package com.z100h.supplychain.core;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

/**
 * [描述信息：说明类的基本功能]
 *
 * @author Elvin Zhao - 279152260@qq.com
 * @version 1.0 Created on 2019年1月2日 下午5:23:25
 */
public enum EvidenceType {

	/**
	 * 转库单
	 */
	TRANSFER("TRANSFER", "转库"),

	/**
	 * 标准入库单
	 */
	CHECKTRANSFER("CHECKTRANSFER", "库存校核转库"),

	/**
	 * 空进入库单
	 */
	NULLRECEIPT("NULLRECEIPT", "空进入库单"),

	/**
	 * 标准入库单
	 */
	RECEIPT("RECEIPT", "入库"),

	/**
	 * 标准入库单
	 */
	CHECKRECEIPT("CHECKRECEIPT", "库存校核入库"),
	/**
	 * 采购入库单
	 */
	PURCHASERECEIPT("PURCHASERECEIPT", "采购入库"),
	/**
	 * 复壮入库单
	 */
	REPAIRIN("REPAIRIN", "复壮入库"),
	/**
	 * 撤场入库单
	 */
	WITHDRAW("WITHDRAW", "撤场入库"),
	/**
	 * 标准出库单
	 */
	STOCKOUT("STOCKOUT", "出库"),
	/**
	 * 租赁出库单
	 */
	RENTOUT("RENTOUT", "订单出库"),

	SUPPLEMENTOUT("SUPPLEMENTOUT", "补单"),
	/**
	 * 空进空出出库单
	 */
	NULLOUT("NULLOUT", "空进空出出库"),

	/**
	 * 复壮调换出库
	 */
	REPAIROUT("REPAIROUT", "复壮调换出库"),
	/**
	 * 售卖出库单
	 */
	SALEOUT("SALEOUT", "售卖出库");

	private String type;

	private String name;

	private EvidenceType(String type, String name) {
		this.type = type;
		this.name = name;
	}

	/**
	 *
	 * @return 
	 */
	public String getType() {
		return type;
	}

	/**
	 *
	 * @param type
	 */
	public void setType(String type) {
		this.type = type;
	}

	/**
	 *
	 * @return 
	 */
	public String getName() {
		return name;
	}

	/**
	 *
	 * @param name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * 入库单类型
	 * @return
	 * @author: Elvin Zhao - 279152260@qq.com 
	 * @date: Created on 2019年2月28日 下午5:04:46
	 */
	public static JSONArray getReceiptType() {
		JSONArray jsonArray = new JSONArray(2);
		JSONObject jsonObjReceipt = new JSONObject();
		jsonObjReceipt.put("type", RECEIPT.type);
		jsonObjReceipt.put("name", RECEIPT.name);
		jsonArray.add(jsonObjReceipt);
		JSONObject jsonObjPurchasereceipt = new JSONObject();
		jsonObjPurchasereceipt.put("type", PURCHASERECEIPT.type);
		jsonObjPurchasereceipt.put("name", PURCHASERECEIPT.name);
		jsonArray.add(jsonObjPurchasereceipt);
		return jsonArray;
	}

	/**
	 * 出库单类型
	 * @return
	 * @author: Elvin Zhao - 279152260@qq.com 
	 * @date: Created on 2019年2月28日 下午5:20:32
	 */
	public static JSONArray getOutType() {
		JSONArray jsonArray = new JSONArray(3);
		JSONObject jsonObjStockout = new JSONObject();
		jsonObjStockout.put("type", STOCKOUT.type);
		jsonObjStockout.put("name", STOCKOUT.name);
		jsonArray.add(jsonObjStockout);
		JSONObject jsonObjRentout = new JSONObject();
		jsonObjRentout.put("type", RENTOUT.type);
		jsonObjRentout.put("name", RENTOUT.name);
		jsonArray.add(jsonObjRentout);
		JSONObject jsonObjPurchaseSaleout = new JSONObject();
		jsonObjPurchaseSaleout.put("type", SALEOUT.type);
		jsonObjPurchaseSaleout.put("name", SALEOUT.name);
		jsonArray.add(jsonObjPurchaseSaleout);
		return jsonArray;
	}

	public static JSONArray getStockoutType() {
		JSONArray jsonArray = new JSONArray(1);
		JSONObject jsonObjStockout = new JSONObject();
		jsonObjStockout.put("type", STOCKOUT.type);
		jsonObjStockout.put("name", STOCKOUT.name);
		jsonArray.add(jsonObjStockout);
		return jsonArray;
	}

	/**
	 * 
	 * 租赁出库
	 * 
	 * @return
	 * @author: Fyh - 1009173473@qq.com 
	 * @date: Created on 2019年4月15日 下午3:10:44
	 */
	public static JSONArray getRentOutType() {
		JSONArray jsonArray = new JSONArray(1);
		JSONObject jsonObjRentout = new JSONObject();
		jsonObjRentout.put("type", RENTOUT.type);
		jsonObjRentout.put("name", RENTOUT.name);
		jsonArray.add(jsonObjRentout);
		return jsonArray;
	}

	/**
	 * 
	 * 复壮调换出库
	 * 
	 * @return
	 * @author: Fyh - 1009173473@qq.com 
	 * @date: Created on 2019年4月22日 下午3:08:20
	 */
	public static JSONArray getRepairOutType() {
		JSONArray jsonArray = new JSONArray(1);
		JSONObject jsonObjRentout = new JSONObject();
		jsonObjRentout.put("type", REPAIROUT.type);
		jsonObjRentout.put("name", REPAIROUT.name);
		jsonArray.add(jsonObjRentout);
		return jsonArray;
	}

	public static EvidenceType get(String type) {
		switch (type) {
			case "TRANSFER":
				return TRANSFER;
			case "CHECKTRANSFER":
				return CHECKTRANSFER;
			case "NULLRECEIPT":
				return NULLRECEIPT;
			case "RECEIPT":
				return RECEIPT;
			case "CHECKRECEIPT":
				return CHECKRECEIPT;
			case "PURCHASERECEIPT":
				return PURCHASERECEIPT;
			case "REPAIRIN":
				return REPAIRIN;
			case "WITHDRAW":
				return WITHDRAW;
			case "STOCKOUT":
				return STOCKOUT;
			case "RENTOUT":
				return RENTOUT;
			case "NULLOUT":
				return NULLOUT;
			case "REPAIROUT":
				return REPAIROUT;
			default:
				return SALEOUT;
		}
	}
}
